<?php

class VoteHelper {


	function display($voteUId, $voteAvg=0, $voteCount=0) {
		// make sure we have a vaild vote result
		if($voteAvg >= 0 && $voteAvg <= 5) {
			// Display vote
			// Add stylesheet to html content
			$width = $voteAvg*10;
		} else {
			$width = 0;
		}
		// Add to ajax event
		return '
		<div class="star-rating">
			<div class="current-rating" style="width:'.$width.'px;" id="vresult_'.$voteUId.'">Currently 3.5/5 Stars.</div>
			<div class="rat"><a href="javascript:void(0);" onclick="javascript:voteAdd(\''.$voteUId.'\', \'1\');" title="1 star out of 5" class="one-star">1</a></div>
			<div class="rat"><a href="javascript:void(0);" onclick="javascript:voteAdd(\''.$voteUId.'\', \'2\');" title="2 stars out of 5" class="two-stars">2</a></div>
			<div class="rat"><a href="javascript:void(0);" onclick="javascript:voteAdd(\''.$voteUId.'\', \'3\');" title="3 stars out of 5" class="three-stars">3</a></div>
			<div class="rat"><a href="javascript:void(0);" onclick="javascript:voteAdd(\''.$voteUId.'\', \'4\');" title="4 stars out of 5" class="four-stars">4</a></div>
			<div class="rat"><a href="javascript:void(0);" onclick="javascript:voteAdd(\''.$voteUId.'\', \'5\');" title="5 stars out of 5" class="five-stars">5</a></div>
		</div>
		
		';
	}
}